package cn.backpackerxl.easyJDBC.util;

import cn.backpackerxl.easyJDBC.annotation.IgnoreField;

import java.io.Serializable;
import java.lang.reflect.Field;

/**
 * @Author: backpackerxl
 * CreateTime: 2022/5/19
 * FileName: FieldObject
 **/
public class FieldObject implements Serializable {
    private final String[] fields;
    private static final long serialVersionUID = 1L;

    public FieldObject(Field[] fields) {
        this.fields = new String[fields.length];
        for (int i = 0; i < fields.length; i++) {
            if (fields[i].isAnnotationPresent(IgnoreField.class)) {
                continue;
            }
            this.fields[i] = fields[i].getName();
        }
    }

    public String[] getFields() {
        return fields;
    }

}
